package com.education.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import com.education.dao.MteacherDao;
import com.education.model.NoticeModel;
import com.education.service.ITeacherAnnouncement;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
/**
 * @author 张露林普通教师主页公告服务层接口的实现
 *
 */
public class TeacherAnnouncementimpl implements ITeacherAnnouncement {
	/**
     * 注入审核人员的数据层接口 CpersonDao
     */
	 @Autowired
	 private MteacherDao mteacher;
	 /**
	* 查询出要显示的所有公告要用分页
	*@param currentPage 当前页
	*@param pageSize 总数据条数
	*@return ResultDo<PageInfo<NoticeModel>> 分页实体 
	*@throws Exception 业务处理层异常
	  *
	  * 2017、8、3修改by雷紫辉：接口返回值定义有不应定义为ResultDo  ResultDo只应该在控制层出现
	*/
	@Override
	public PageInfo<NoticeModel> selectAnnouncement(int currentPage, int pageSize) throws Exception {
		// TODO Auto-generated method stub
		PageHelper.startPage(currentPage, pageSize);
        List<NoticeModel> list = this.mteacher.queryAdvertising();
        PageInfo<NoticeModel> PageBean = new PageInfo<>(list);

		return PageBean;
	}
	/**
	 * 审核人员根据id查询出要显示的公告详细信息
     *@return NoticeModel
     *@throws Exception 业务处理层异常
     */
	@Override
	public NoticeModel selectAnnouncementDetail(int noticeId) throws Exception {

		NoticeModel  student= mteacher.queryAdvertisingDetails(noticeId);
		return student;
	}

}
